package org.jsets.fastboot.service.impl;

import java.sql.SQLException;
import javax.sql.DataSource;
import org.jsets.fastboot.entity.Book;
import org.jsets.fastboot.mapper.BookMapper;
import org.jsets.fastboot.service.IBookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * 行政区划 <br>
 *
 * @author wj596
 */
@Service
public class BookService extends ServiceImpl<BookMapper, Book>implements IBookService {

	@Autowired
	DataSource dataSource;
	
	@Override
	public void ds1() {
		//RoutingDataSource rds = (RoutingDataSource)dataSource;
		try {
			System.out.println("ds1:"+dataSource.getConnection().getMetaData().getURL());
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

	@Override
	//@SwitchDataSource("sqlserver")
	public void ds2() {
		try {
			System.out.println("ds2:"+dataSource.getConnection().getMetaData().getURL());
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}


}